<!-- Copyright 2020 The Chromium Authors. All rights reserved.
     Use of this source code is governed by a BSD-style license that can be
     found in the LICENSE file. -->

<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/load_time_data.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">

<link rel="import" href="../../components/html_echo.html">
<link rel="import" href="../../components/oobe_icons.html">
<link rel="import" href="../../components/behaviors/login_screen_behavior.html">
<link rel="import" href="../../components/behaviors/multi_step_behavior.html">
<link rel="import" href="../../components/behaviors/oobe_i18n_behavior.html">
<link rel="import" href="../../components/buttons/oobe_text_button.html">
<link rel="import" href="../../components/common_styles/common_styles.html">
<link rel="import" href="../../components/common_styles/oobe_dialog_host_styles.html">
<link rel="import" href="../../components/dialogs/oobe_adaptive_dialog.html">

<dom-module id="tpm-error-message-element">
  <template>
    <style include="oobe-dialog-host-styles"></style>
    <oobe-adaptive-dialog id="errorDialog" role="dialog"
        aria-label$="[[i18nDynamic(locale, 'errorTpmFailureTitle')]]">
      <iron-icon slot="icon" icon="oobe-32:warning"></iron-icon>
      <h1 slot="title" for-step="default">
        [[i18nDynamic(locale, 'errorTpmFailureTitle')]]
      </h1>
      <h1 slot="title" for-step="dbus-error">
        [[i18nDynamic(locale, 'errorTpmDbusErrorTitle')]]
      </h1>
      <p slot="subtitle" for-step="default,dbus-error">
        [[i18nDynamic(locale, 'errorTpmFailureReboot')]]
      </p>
      <div slot="content" for-step="default,dbus-error" class="flex layout
          vertical center center-justified">
        <img src="/images/error.svg"
            class="oobe-illustration" aria-hidden="true">
      </div>
      <h1 slot="title" for-step="tpm-owned">
        [[i18nDynamic(locale, 'errorTPMOwnedTitle')]]
      </h1>
      <p slot="subtitle" for-step="tpm-owned">
        [[i18nDynamic(locale, 'errorTPMOwnedSubtitle')]]
      </p>
      <html-echo slot="content" for-step="tpm-owned" class="flex layout
          vertical center center-justified"
          content="[[getTPMOwnedFailureContent_(locale)]]"></html-echo>
      <div slot="bottom-buttons">
        <oobe-text-button id="restartButton" inverse class="focus-on-show"
            text-key="errorTpmFailureRebootButton" on-click="onRestartTap_">
        </oobe-text-button>
      </div>
    </oobe-adaptive-dialog>
  </template>
  <script src="tpm_error.js"></script>
</dom-module>
